import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { LoginMainComponent } from './login/login-main/login-main.component';
import { StaffMainComponent } from './staff/staff-main/staff-main.component';


import { AuthGuard } from './auth/auth.guard'
import { ManagerMainComponent } from './manager/manager-main/manager-main.component';
import { ManagerDealOutComponent } from './manager/manager-deal-out/manager-deal-out.component';
import { ManagerDealLeaveComponent } from './manager/manager-deal-leave/manager-deal-leave.component';
import { ManagerLookLeaveComponent } from './manager/manager-look-leave/manager-look-leave.component';

import { AdministrativeMainComponent } from './administrative/administrative-main/administrative-main.component';
import { AdministrativeEmployeeinfoComponent } from './administrative/administrative-employeeinfo/administrative-employeeinfo.component';
import { AdministrativeSigninInfoComponent } from './administrative/administrative-signin-info/administrative-signin-info.component';
import { AdministrativeLeaveInfoComponent } from './administrative/administrative-leave-info/administrative-leave-info.component';
import { AdministrativeOutInfoComponent } from './administrative/administrative-out-info/administrative-out-info.component';
import { AdministrativeRegisterComponent } from './administrative/administrative-register/administrative-register.component';

import { SignInComponent } from './staff/stock/sign-in/sign-in.component';
import { OutRequestComponent } from './staff/stock/out-request/out-request.component';
import { LeaveRequestComponent } from './staff/stock/leave-request/leave-request.component';
import { LeaveRequestStateComponent } from './staff/stock/leave-request-state/leave-request-state.component';
import { OutRequestStateComponent } from './staff/stock/out-request-state/out-request-state.component';

/*

@Author:赵明洋、刘洋、李朝晖

@Date: 2018-12-12

@路由实现

@Last Modified time: 2018-12-16
*/
const routes: Routes = [
  { path: '', redirectTo: '/login', pathMatch: 'full' },
  { path: 'login', component: LoginMainComponent },
  
  {
    path: 'staff',
    component: StaffMainComponent,
    canActivate: [AuthGuard],
    children: [
      {path:'signin' , component: SignInComponent},
      {path:'outrequest' , component:OutRequestComponent},
      {path:'leaverequeststate/:id' , component:LeaveRequestComponent},
      {path:'outrequeststate' , component:OutRequestStateComponent},
      {path:'leaverequeststate' , component:LeaveRequestStateComponent},
      {path:'outrequeststate/:id' , component:OutRequestComponent},
    ]
  },
  {
    path: 'administrative',
    component: AdministrativeMainComponent,
    canActivate: [AuthGuard],
    children: [
      { path: 'leaveinfo',component:AdministrativeLeaveInfoComponent},
      { path: 'employeeinfo',component:AdministrativeEmployeeinfoComponent},
      { path: 'outinfo',component:AdministrativeOutInfoComponent},
      { path: 'signininfo',component:AdministrativeSigninInfoComponent},
      { path: 'register',component:AdministrativeRegisterComponent}
    ]
  },
  {
    path: 'manager',
    component: ManagerMainComponent,
    canActivate: [AuthGuard],
    children: [
      {path: 'deal/out', component: ManagerDealOutComponent},
      {path: 'deal/leave', component: ManagerDealLeaveComponent},
      {path: 'look', component: ManagerLookLeaveComponent},
    ]
  },
];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule]
})
export class AppRoutingModule { }
